package com.youngking.guns.modular.example.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.youngking.guns.config.properties.JwtProperties;
import com.youngking.guns.core.base.controller.BaseController;
import com.youngking.guns.modular.auth.util.JwtTokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 常规控制器
 *
 * @author fengshuonan
 * @date 2017-08-23 16:02
 */
@Controller
@RequestMapping("/app/hello")
public class ExampleController extends BaseController {
    @Autowired
    private JwtTokenUtil jwtTokenUtil;

    @Autowired
    private JwtProperties jwtProperties;

    @RequestMapping("")
    public ResponseEntity hello(@RequestBody String simpleObject) {
        JSONObject mapTypes = JSON.parseObject(simpleObject);
       String name = (String) mapTypes.get("name");
        //Member member = jwtTokenUtil.getUser(super.getToKen(jwtProperties.getHeader()));
        System.out.println(simpleObject);
        return ResponseEntity.ok("请求成功!");
    }
}
